package com.jsong.linuo.controlstructure;

import java.util.Scanner;

/*
    将数据通过键盘录入的形式放到代码中参与运行
*/
public class ScannerTest {
    public static void main(String[] args) {
        //创建对象
        Scanner sc = new Scanner(System.in);

        //录入int整型-录入数据不一致会报错
        int data1 = sc.nextInt();
        System.out.println("data1 = " + data1);

        //录入String型字符串
        String data2 = sc.next();
        System.out.println("data2 = " + data2);

        /*
           区别
            next():遇到空格和回车结束录入
            nextLine():遇到回车结束录入
         */

    }
}
